# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=libcoap
pkgver=4.3.0
pkgrel=1
pkgdesc="A CoAP (RFC 7252) implementation"
url="https://libcoap.net/"
arch="all"
license="BSD-2-Clause"
makedepends="automake autoconf libtool asciidoc openssl1.1-compat-dev cunit-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/obgm/libcoap/archive/v$pkgver.tar.gz"

build() {
	./autogen.sh
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-openssl \
		--disable-doxygen \
		--enable-tests
	make
}

check() {
	./tests/testdriver
}

package() {
	make DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	install -m644 CONTRIBUTE AUTHORS ChangeLog NEWS README.md TODO \
		"$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
a564d3e3f77236f0acb6b5fab6dbcb4bfd5d53ddafa13013fe1652b61d8a69aa8e679bcec6d66d1eafa62b6d0db2cf0b566abb11a9200e30b57ff11d40b17299  libcoap-4.3.0.tar.gz
"
